home *** CD-ROM | disk | FTP | other *** search
- unit dd3comm;
-
- interface
-
- uses dd3fos, dd3async;
-
-
- type
- AsyncIoTypes = (Internal,Fossil);
- var
- Local : boolean; {Local Only Mode}
- AsyncType : AsyncIOTypes;
- Com_port : byte;
- lockedbaud : longint; {Locked BaudRate}
- NonSport : string[4]; {Non Stardard Port}
- NonSIrq : integer;
- usefossil : boolean; {Use Fossil?}
- baud_rate : longint; {Baud Rate From Drop File}
- Initok : boolean;
-
- const
- internalinsize : word = 256;
- internaloutsize : word = 32;
-
- procedure AsyncOpenPort;
- procedure AsyncSendChar(ch: char);
- procedure AsyncSendStr(s : string);
- function AsyncReceiveChar : char;
- function AsyncCarrierPresent: boolean;
- function AsyncCharPresent: boolean;
- procedure AsyncCloseUp;
- procedure AsyncCloseCom(cp : byte);
- procedure AsyncSetBaud(n: longint);
- procedure AsyncSetDTR(state: boolean);
- procedure AsyncFlushOutput;
- procedure AsyncPurgeOutput;
- procedure AsyncSetFlow(SoftTran,Hard,SoftRecv: boolean);
- Procedure AsyncBufferStatus(var Insize,infree,outsize,outfree: word;
- var fossilname:string);
-
-
- implementation
-
- procedure AsyncOpenPort;
- begin;
- case AsyncType of
- Internal : begin
- if NonSIrq > 0 then C_PortInt[Com_port] := NonSIrq;
- {if NonSPort > '' then C_PortAddr[Com_Port] := str_to_int(NonSPort);}
- OpenCom(Com_Port,InternalInSize,InternalOutSize);
- ComParams(com_port,lockedbaud,8,'N',1);
- AsyncPurgeOutPut;
- AsyncFlushOutPut;
- end;
- Fossil : begin
- end;
- end;{case}
- end;
-
- procedure AsyncSendChar(ch: char);
- begin;
- case AsyncType of
- Internal : ComWriteChW(com_port,ch);
- Fossil : ;
- end;
- end;
- procedure AsyncSendStr(s : string);
- var
- i : byte;
- begin
- case asynctype of
- Internal : for i := 1 to length(s) do AsyncSendChar(s[i]);
- Fossil : ;
- end;
-
- end;
-
- function AsyncReceiveChar : char;
- var
- b: boolean;
- ch : char;
- begin;
- case asynctype of
- internal : begin
- ch := comreadchw(com_port);
- asyncreceivechar := ch;
- end;
- fossil : begin
- end;
- end;{case}
- end;
-
- function AsyncCarrierPresent: boolean;
- begin;
- case asynctype of
- internal : AsyncCarrierPresent:=DCDStat(com_port);
- fossil : ;
- end;{case}
- end;
-
- function AsyncCharPresent: boolean;
- begin;
- case asynctype of
- internal : asynccharpresent:=combufferleft(com_port,'I')<>c_insize[com_port];
- fossil : ;
- end;{case}
- end;
-
-
-
- procedure AsyncCloseUp;
- begin;
- case asynctype of
- internal : closeallcoms;
- fossil : ;
- end;{Case}
- end;
-
- procedure AsyncCloseCom;
- begin;
- case asynctype of
- internal : closecom(cp);
- fossil : ;
- end;{case}
- end;
-
- procedure AsyncSetBaud(n: longint);
- var
- i:byte;
- begin;
- case asynctype of
- internal : comparams(com_port,n,8,'N',1);
- fossil : ;
- end;
- end;
-
- procedure AsyncSetDTR(state: boolean);
- var
- c : char;
- begin;
- case asynctype of
- internal : SetDTR(com_port,state);
- fossil : ;
- end;
- end;
-
- procedure AsyncFlushOutput;
- begin;
- case asynctype of
- internal : ComWaitForClear(com_port);
- fossil : ;
- end;
- end;
-
- procedure AsyncPurgeOutput;
- begin;
- case asynctype of
- internal : ClearCom(com_port,'O');
- fossil : ;
- end;
- end;
-
- procedure AsyncSetFlow(SoftTran,Hard,SoftRecv: boolean);
- begin;
- case asynctype of
- internal : begin
- SetCTSMode(com_port,hard);
- SetRTSMode(com_port,hard,C_RTSOn[com_port],C_RTSOff[com_port]);
- end;
- fossil : ;
- end; {case}
- end;
-
- Procedure AsyncBufferStatus(var Insize,infree,outsize,outfree: word;
- var fossilname:string);
- begin;
- case asynctype of
- internal : begin
- insize:=internalinsize;
- outsize:=internaloutsize;
- infree:=combufferleft(com_port,'I');
- outfree:=combufferleft(com_port,'O');
- end;
- fossil : ;
- end;{case}
-
- end;
- begin;
- com_port := 0; {Set Port to Zero}
- Local := false; {Set to Local}
- asynctype := Internal;
- end.
-